package com.agileboot.domain.question.query;

import com.agileboot.common.core.page.AbstractPageQuery;
import com.agileboot.domain.question.db.Question;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author lx
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class QuestionQuery extends AbstractPageQuery<Question> {
    //问题类型
    private Integer quType;
    //题库名称
    private String quBankName;
    //题目类容
    private String quContent;

    @Override
    public QueryWrapper<Question> addQueryCondition() {
        QueryWrapper<Question> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotBlank(quBankName), "qu_bank_name", quBankName)
                .eq(quType != null, "qu_type", quType)
                .like(StringUtils.isNotBlank(quContent), "qu_content", quContent);
        return queryWrapper;
    }
}
